package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	MySQLConfig
	RedisConfig
}

type MySQLConfig struct {
	Name   string
	Pwd    string
	Head   string
	Pore   int
	DBName string
}

type RedisConfig struct {
	Addr     string
	Password string
	Pore     int
	DB       int
}

var AppDataRpc AppConfig

func InitAppConfigRpc() {

	viper.SetConfigFile("./appconfig/config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		fmt.Println("获取动态配置文件失败", err)
		return
	}
	viper.Unmarshal(&AppDataRpc)
	fmt.Println("获取动态配置文件成功", AppDataRpc)

}
